<template>
    <div>
        <van-field
            readonly
            v-model="model[modelLabel]"
            :name="modelLabel"
            :label="label"
            :placeholder="`请输入与${label}`"
            :rules="[{ required: true, message: `请输入与${label}` }]"
            @click="timePicker = true"
        />
        <van-popup v-model="timePicker" position="bottom">
            <van-datetime-picker
                :type="type"
                @confirm="timeConfirm"
                @cancel="timePicker = false"
                :min-date="new Date()"
            />
        </van-popup>
</div>

</template>
<script>
export default {
    name: '',
    props: {
        
        value:[Object,String],

        modelLabel:{
            type:String,
            default:'',
        },

        label:{
            type:String,
            default:'',
        },

        type:{
            type:String,
            default:'datetime',  
        }
    },
    data () {
        return {
            timePicker:false
        }
    },
    computed: {
        model:{
            get(){
                return this.value
            },

            set(e){
                this.$emit('input',e);
            }
        }
    },
    watch: {

    },
    methods: {  
        timeConfirm(val){
            this.$set(this.model , this.modelLabel , this.dateTotime(val));
            this.timePicker = false;
        }

    },
    created () {
    },
    mounted () {
    },
}
</script>
<style lang="less" scoped>

</style>

